<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp" %>
<title>修改员工密码</title>
</head>
<body>
<fieldset class="layui-elem-field" style="margin:20px; padding:15px;">
    <legend>信息维护--修改密码</legend>
     <form class="layui-form" lay-filter="formA" method="post"> 
         <hr class="layui-bg-blak"/>
         <div class="layui-form-item">
             <label class="layui-form-label">编号 <span class="required" style="color:red">*</span></label>
             <div class="layui-input-inline">
                 <input type="text" name="code" readonly class="layui-input">
             </div>
         </div><br />
         <div class="layui-form-item">
             <label class="layui-form-label">修改密码 <span class="required" style="color:red">*</span></label>
             <div class="layui-input-inline">
                 <input type="password" name="pass1" class="layui-input" placeholder="请输入密码">
             </div>
         </div><br />
         <div class="layui-form-item">
             <label class="layui-form-label">确认密码 <span class="required" style="color:red">*</span></label>
             <div class="layui-input-inline">
                 <input type="password" name="pass2" class="layui-input" placeholder="请确认密码">
             </div>
         </div><br />
         <div class="layui-form-item">
             <div class="layui-input-block">
                 <input type="button" class="layui-btn" lay-submit lay-filter="updPass" value="修改">
                 <input type="button" class="layui-btn" onclick="closeThis()" value="取消">
             </div>
         </div>
         <input type="hidden" name="action" value="setPass">
     </form>
</fieldset>
<script type="text/javascript">
var code= '<%= request.getParameter("code")%>';

init();
function init(){
    ajax("/employee",{action:'get', code:code}, 'json', function(data){
    	 $("input[name='code']").val(data.code);
    })
}

$("input[value='修改']").click(updPass)
function updPass(){
	var pass1 = $("input[name='pass1']").val();
	var pass2 = $("input[name='pass2']").val();
	if(pass1 === pass2){
		formSubmit("/employee",'submit(updPass)','text',function(data){
		    if(1 == data){
		        layer.msg("修改成功", closeThis);
		    }else{
		        layer.msg("修改失败");
		    }
		});
	}else {
		layer.msg('两次输入的密码不同，请重新输入!',{icon:0,time:2000},function(){
			$("input[name='pass1']").val('');
			$("input[name='pass2']").val('');
		});
	}
		
}




</script>
</body>
</html>